package com.tianheng.modbus.entity;


import com.tianheng.modbus.enums.ProtocolTypeEnum;
import lombok.Data;
import lombok.ToString;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;


import javax.persistence.*;
import java.util.List;

@Data
@Entity
public class ModbusDeviceTemplate {

    @Id
    private Long id;

    @Column(name = "name")
    private String name;

	@Column(name = "company_id")
	private Long companyId;

    @Enumerated(EnumType.STRING)
    @Column(name = "protocol")
    private ProtocolTypeEnum protocol;


    @OneToMany(mappedBy = "modbusDeviceTemplate",fetch= FetchType.EAGER)
    @NotFound(action= NotFoundAction.IGNORE)
    private List<ModbusDeviceTemplateProperty> propertys;

}